<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    
</body>
</html>
<script>
    let obj = { name:'蔡徐坤',age:24,money:1000000,hobby:['唱歌','跳舞','rep'] }
    //JSON.parse() 将json字符串 转换为 json对象
    //JSON.stringify()将json对象 转换为 json字符串
    //json字符串 要求字符串中每个属性名必须用""包裹，每个字符串必须用""包裹，不能有注释，不能有多余的逗号
    // var obj2 = JSON.parse( `{ "name":"李煜",  "age":30, "sex":true ,"hobby":["打球","听音乐"] }` );
    let obj2 = JSON.parse(JSON.stringify(obj))

    console.log(obj);
    obj2.hobby.push('打篮球')
    console.log(obj2);
</script>